<?php

/**
 * Liên hệ
 *
 * @version $Rev:$
 * @license
 */
class Contact_IndexController extends Zend_Controller_Action
{

    public function init()
    {
        $this->params = $this->getRequest()->getParams();
        System_Template::using("contact","Default");
        $this->model = new Contact_Model_Contact();
        parent::init();
        
    }

    public function indexAction()
    {
		$this->view->sucess = $this->params['success'];
    }

    public function saveAction()
    {
    	$date = new DateTime();
    	$today = $date->format('Y/m/d H:i:s');
		$data = array(
		"NAME" => $this->params['NAME'], 
		"PHONE" => '',
		"EMAIL" => $this->params['EMAIL'],
		"ADDRESS" => '',
		"TITLE" => $this->params['TITLE'],
		"CONTENT" => $this->params['CONTENT'],
		"ISREAD" => 0,
		"SENT_DATE" => $today,
		);
		$this->model->insert($data);
        $this->_redirect('/contact/index/index/success/1');
    }
    
}

